//
//  StrategyView.m
//  NewNest
//
//  Created by hesiyao on 16/1/17.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "StrategyView.h"
#import <UIColor+Wonderful.h>
@implementation StrategyView

- (void)dealloc
{
    [_backImg release];
    [_nameLabel release];
    [_userImg release];
    [_titleLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        //加模糊效果
        UIBlurEffect *b = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
        UIVisualEffectView *effect = [[UIVisualEffectView alloc] initWithEffect:b];
        effect.frame = self.frame;
        effect.alpha = 0.8;
        [self addSubview:effect];
        [effect release];
        
        //上方的背景图片
        self.backImg = [[UIImageView alloc] initWithFrame:self.bounds];
//        _backImg.backgroundColor = [UIColor yellowColor];
        [self addSubview:_backImg];
        [_backImg release];
        //用户头像
        self.userImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.frame.size.height / 3 , self.frame.size.height / 4, self.frame.size.height / 4)];
        self.userImg.center = CGPointMake(self.center.x, _userImg.center.y);
        [self addSubview:_userImg];
//        _userImg.backgroundColor = [UIColor redColor];
        _userImg.layer.cornerRadius = _userImg.frame.size.width / 2;
        _userImg.clipsToBounds = YES;
        [_userImg release];
        //用户名
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _userImg.frame.origin.y + _userImg.frame.size.height + 5, self.frame.size.width, self.frame.size.height / 8)];
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_nameLabel];
        _nameLabel.font = [UIFont systemFontOfSize:15];
        _nameLabel.textColor = [UIColor seaShell];
//        _nameLabel.backgroundColor = [UIColor blueColor];
        [_nameLabel release];
        //文章名称
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _nameLabel.frame.origin.y + _nameLabel.frame.size.height + 5, _nameLabel.frame.size.width, _nameLabel.frame.size.height)];
        [self addSubview:_titleLabel];
//        _titleLabel.backgroundColor = [UIColor greenColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.textColor = [UIColor seaShell];
        [_titleLabel release];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
